package com.zhongge.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName PageConfig
 * @Description TODO
 * @Author zhongge
 * @Version 1.0
 */
@Configuration
public class PageConfig {
    @Bean
    public MybatisPlusInterceptor getMybatisPlusInterceptor(){
        //创建拦截器容器
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        //创建分页插件
        PaginationInnerInterceptor mysql = new PaginationInnerInterceptor(DbType.MYSQL);
        //装入分页插件
        mybatisPlusInterceptor.addInnerInterceptor(mysql);
        //将容器返回
        return mybatisPlusInterceptor;
    }
}
